package com.anbang.app.ui.frame.study.recycleView

import android.graphics.Canvas
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.os.Parcel
import android.os.Parcelable
import android.view.View
import androidx.recyclerview.widget.RecyclerView


/**
 * 自定义分割线
 */
class MyDividerItemDecoration() : RecyclerView.ItemDecoration(), Parcelable {

    private var mDivider :Drawable? =null
    private var  attrs = arrayOf(android.R.attr.listDivider)

    constructor(parcel: Parcel) : this() {

    }


    override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
        super.onDrawOver(c, parent, state)
    }


    override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
        super.onDraw(c, parent, state)
    }

    override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
        // 四个方向的偏移值
        //outRect.set(0, 0, mDivider.getIntrinsicWidth(), mDivider.getIntrinsicHeight());
        outRect.set(0, 0, 0, 0)
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {

    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<MyDividerItemDecoration> {
        override fun createFromParcel(parcel: Parcel): MyDividerItemDecoration {
            return MyDividerItemDecoration(parcel)
        }

        override fun newArray(size: Int): Array<MyDividerItemDecoration?> {
            return arrayOfNulls(size)
        }
    }
}